(function(){
	function initTemplate() {
		$.templates({
			channelTemplate: "#channelTemplate",
			channelSubTemplate: "#channelSubTemplate",
			programTemplate: "#programTemplate",
			programSubTemplate: "#programSubTemplate",
			episodeTemplate: "#episodeTemplate",
			episodeSubTemplate: "#episodeSubTemplate",
			episodeDetailTemplate: "#episodeDetailTemplate",
			contentsTemplate: "#contentsTemplate",
			myPlayListTemplate: "#myPlayListTemplate",
			eventListTemplate: "#eventListTemplate",
			promotionListTemplate: "#promotionListTemplate",
			expiredListTemplate: "#expiredListTemplate",
			likeStaticsTemplate: {
									markup: "#likeStaticsTemplate",
									templates: {
										likeAgeTemplate: "#likeAgeTemplate",
										likeRankTemplate: "#likeRankTemplate"
									}
								}
		});
	}
	$.views.helpers({
		classOn: function( index ){
			return index == 0 ? 'class=on' : '';
		},
		per: function( cnt, total ) {
			return Math.round((cnt / total ) * 100) + '%';
		},
		flag: function( flag ) {
			return flag == 'Y' ? 'class="on"' : '';
		},
		num: function( n ) {
			return CJ.util.numDot( n );
		},
		dateTodate: function( d , split){
			return CJ.util.getDateStr(d, split);
		},
		numTodate: function( d ){
			return CJ.util.getDateStr(d, '.');
		},
		dday: function( d ){
			var endDate = CJ.util.getDateDay(d);
			var nowDate = new Date();
			return Math.floor((endDate - nowDate) / 86400000);
		}
	});

	$.views.converters({
		
	});
	$(document).ready(function(){
		initTemplate();
	});
})();